package com.itheima.controller.c_params;

import com.itheima.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


import javax.servlet.http.HttpServletRequest;
import java.util.Date;


@Controller
@RequestMapping("/params")
public class UserController {

    @RequestMapping("/save")
    public String save(String id,String name){
        System.out.println(id+"----"+name);
        return "success";
    }


    @RequestMapping("/update")
    public String update(User user){
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/update1")
    public String update1(User user){
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/update2")
    public String update2(User user){
        System.out.println(user);
        return "success";
    }

    @RequestMapping("/testparams")
    public String test(@RequestParam("uid") int id){
        System.out.println("好棒啊"+id);
        return "success";
    }

    @RequestMapping("/birth")
    public String test1(Date birth){
        System.out.println(birth);
        return "success";
    }

    @RequestMapping ("/abc")
    public String testori(HttpServletRequest request){
        String id = request.getParameter("id");
        System.out.println(id);
        return "success";

    }
}
